hvm: Lower HPET frequency to 1/32 of the TSC.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 19 Mar 2007 13:48:00 +0000 (13:48 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 19 Mar 2007 13:48:00 +0000 (13:48 +0000)
commitf8b68fe2dad1e6bf4f55483dd023561d3ee008cb
treeb52472f7c81308c900445a76db8ef1cebc50e949
parent70fe04c768682d517d887d27f7dc195e616a38f5
hvm: Lower HPET frequency to 1/32 of the TSC.

The frequency of HPET device model is defined to be the same as TSC's,
but this doesn't work well with calibrate_tsc_hpet() in Linux kernel
2.6.16-33, causing some IA32 Linux HVM guests to failt o boot.

Calibrate_tsc_hpet() tries to figure out how many HPET ticks a TSC
cycle equals; it magnifies the result by scale of 2^32, trying to get
a more accurate result since it assumes the frequency of HPET in real
world is usually less than 1/100 of TSC, so the result of "(2^32 *
hpet_freq) / tsc_freq" may exceed 32bits, then a "divide error
(overflow)" would occur!

The result doesn't overflow every time because hpet_freq/tsc_freq may
less than 1.0 due to the little inaccuracy in the implementation of
HVM timer virtualization.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
xen/arch/x86/hvm/hpet.c